import pygame.sprite


class Image(pygame.sprite.Sprite):
    def __init__(self, path, pos, size):
        self.path = path
        self.pos = list(pos)
        self.size = size
        self.updateImage()

    def updateImage(self):
        self.image = pygame.image.load(self.path)
        if self.size:
            self.image = pygame.transform.scale(self.image, self.size)

    def getRect(self):
        rect = self.image.get_rect()
        rect.x, rect.y = self.pos
        return rect

    def draw(self, ds):
        ds.blit(self.image,self.getRect())
